<%@page import="helpers.UrlHelper"%>
<%@page import="helpers.DateHelper"%>
<%@page import="helpers.SoftwareHelper"%>
<%@page import="helpers.StringHelper"%>
<%@page import="helpers.HeaderHelper"%>
<%@page import="models.Software"%>
<%@page import="java.util.ArrayList"%>
<%
	HeaderHelper headerHelper = (HeaderHelper) request.getAttribute("headerHelper");
	ArrayList<Software> softwares = (ArrayList<Software>) request.getAttribute("softwares");
%>
<jsp:include page="/layouts/header.jsp">
    <jsp:param name="title" value="<%=headerHelper.getTitle()%>" />
    <jsp:param name="description" value="<%=headerHelper.getDescription()%>" />
    <jsp:param name="keywords" value="<%=headerHelper.getKeywords()%>" />
    <jsp:param name="ogite_name" value="<%=headerHelper.getOgite_name()%>" />
    <jsp:param name="ogtitle" value="<%=headerHelper.getOgtitle()%>" />
    <jsp:param name="ogimage" value="<%=headerHelper.getOgimage()%>" />
    <jsp:param name="ogurl" value="<%=headerHelper.getOgurl()%>" />
    <jsp:param name="ogescription" value="<%=headerHelper.getOgescription()%>" />
</jsp:include>
<link rel="stylesheet" href="/css/slide.css">
<script src="/js/slides.min.jquery.js"></script>
	<script>
		$(function(){			
			$('#slides').slides({
				preload: true,
				preloadImage: '/images/loading.gif',
				hoverPause: true
			});
		});
	</script>
	<%
	if (softwares.size() > 0) {
		Software software = softwares.get(0);
	%>
		<!-- 2 - top content -->
    	<div id="top-content" class="soft-info">
    		<!-- 3 - top-content left -->
    		<div class="left">
    			<div class="item">
    				<% String ext = StringHelper.getFileExtend(software.getArtworkUrl100()); %>
    				<div class="thumbnail"><img src="<%=ext.equalsIgnoreCase("tif") || ext.equalsIgnoreCase("tiff") ? software.getArtworkUrl60() : software.getArtworkUrl100() %>" width="125" height="125"/></div>
    				<div class="info">
    					<div class="info-top">
    						<h1><a><%=software.getTrackName() %></a></h1>
    						<div class="desc">
    							Compatible with 
    							<% 
    							ArrayList<String> devices = SoftwareHelper.getSupportDevice(software.getSupportedDevices()); 
    							for (int i = 0; i < devices.size(); i++) {
    							%>
    							<h2><%=devices.get(i)%></h2>
    							<%=i<devices.size()-1?"," : "" %>
    							<% } %>
    							<div class="clear"></div>
    							<br />
    							<div class="adv">
   									<script type="text/javascript"><!--
									google_ad_client = "ca-pub-4975603569119809";
									/* traceip_468x15 */
									google_ad_slot = "6636286518";
									google_ad_width = 468;
									google_ad_height = 15;
									//-->
									</script>
									<script type="text/javascript"
									src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
									</script>
   								</div>
    						</div>
    					</div>
    					<div class="social-buttons">
    						<!-- AddThis Button BEGIN -->
    						
							<div class="addthis_toolbox addthis_default_style ">
							<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
							<a class="addthis_button_tweet"></a>
							<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
							<a class="addthis_counter addthis_pill_style"></a>
							</div>
							<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f4f217074402877"></script>
							
							<!-- AddThis Button END -->
    					</div>
    				</div>
    			</div>
    		</div>
    		<!-- 3 - end top-content left -->
    		
    		<!-- 3 - top-content right -->
    		<div class="right">
    			<div class="extra">
    				<div class="e-item">
    					<div class="block">
    						<div class="sprite-icon"></div>
    						<span class="feature-icon">Category</span>
    					</div>
    					<div class="block">
    						<span><a href="/home?<%=UrlHelper.createUrl(Integer.toString(software.getPrimaryGenreId()), "genre", request)%>"><%=software.getPrimaryGenreName()%></a></span>
    					</div>
    					<div class="clear"></div>
    				</div>
    				
    				<div class="e-item">
    					<div class="block">
    						<div class="sprite-icon"></div>
    						<span class="feature-icon">Size</span>
    					</div>
    					<div class="block">
    						<span><%=StringHelper.int2size(software.getFileSizeBytes()) %></span>
    					</div>
    					<div class="clear"></div>
    				</div>
    				<div class="e-item">
    					<div class="block">
    						<div class="sprite-icon"></div>
    						<span class="feature-icon">Version</span>
    					</div>
    					<div class="block">
    						<span><%=software.getVersion() %></span>
    					</div>
    					<div class="clear"></div>
    				</div>
    			</div>
    		</div>
    		<!-- 3 - end top-content right -->
			<!-- 3 - menu-tabs -->
			<ul class="menu-tabs">
				<!-- 
				<li class="tab selected">
					<a href="#">
						<div class="sprite-icon img"></div>
						<span class="tab-text">Description</span>
					</a>
				</li>
				 -->
			</ul>
			<!-- 3 - end menu-tabs -->
			
    	</div>
    	<!-- 2 - end top content -->
    	
    	<!-- 2 - main-content -->
    	<div class="main-content">
    		<!-- 3 - left-pane -->
    		<div class="left-pane">
    			<div class="software-info">
    				<div class="description">
    					<div class="widget">
    						<div class="price">
    							<%=SoftwareHelper.getPrice(software.getPrice(), software.getCurrency()) %>
								<a target="_blank" href="<%=software.getTrackViewUrl() %>">Buy Now</a>
    						</div>
    					</div>
    					<p class="adv">
							<script type="text/javascript"><!--
							google_ad_client = "ca-pub-4975603569119809";
							/* traceip_468x15 */
							google_ad_slot = "6636286518";
							google_ad_width = 468;
							google_ad_height = 15;
							//-->
							</script>
							<script type="text/javascript"
							src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
							</script>
						</p>
						
						<div class="adv left-info">
							<script type="text/javascript"><!--
							google_ad_client = "ca-pub-4975603569119809";
							/* traceip_250x250 */
							google_ad_slot = "1926885314";
							google_ad_width = 250;
							google_ad_height = 250;
							//-->
							</script>
							<script type="text/javascript"
							src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
							</script>
						</div>
						<%=software.getDescription().getValue().replaceAll("\n", "<br>")%>	
					</div>
					<br />
					<div class="adv">
	    				<script type="text/javascript"><!--
						google_ad_client = "ca-pub-4975603569119809";
						/* 1stapp 468x60 */
						google_ad_slot = "3325259718";
						google_ad_width = 468;
						google_ad_height = 60;
						//-->
						</script>
						<script type="text/javascript"
						src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
						</script>
	    			</div>
	    			<br />
					
					<div class="update">
						<h3><label>What's New in Version </label></h3>
						<%=software.getReleaseNotes().getValue().replaceAll("\n", "<br>") %>
					</div>
					<div class="screenshot">
						<h3><label>Screenshots</label></h3>
						<div id="slides">
							<div class="slides_container">
								<% 
								ArrayList<String> screens = software.getScreenshotUrls(); 
								for (int i = 0; i < screens.size(); i++) {
								%>
								<a><img src="<%=screens.get(i) %>" width="500"/></a>
								<%
								}
								%>
							</div>
							<a href="#" class="prev"><img src="/images/arrow-prev.png" width="24" height="43" alt="Arrow Prev"></a>
							<a href="#" class="next"><img src="/images/arrow-next.png" width="24" height="43" alt="Arrow Next"></a>
						</div>
					</div>
					<div class="clear"></div>
    			</div>
    		</div>
    		<!-- 3 - end left-pane -->
    		
    		<!-- 3 - right-pane -->
    		<div class="right-pane">
    			<div style="height: 20px;"></div>
    			<div class="block style1">
	    			<script type="text/javascript"><!--
					google_ad_client = "ca-pub-4975603569119809";
					/* 200x200 */
					google_ad_slot = "2288453523";
					google_ad_width = 200;
					google_ad_height = 200;
					//-->
					</script>
					<script type="text/javascript"
					src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
					</script>
				</div>
				
    			<!-- 4 - style1 -->
    			<div class="block style1">
    				<div class="head-text">
						<span>More</span>
						<span style="color: rgb(130, 171, 221);">informations</span>
					</div>
					<div class="info-app">
						<div class="info">
							<b>Seller:</b> <%=software.getSellerName() %>
						</div>
						<div class="info">
							<b>Last changed:</b> <%=DateHelper.getStringFromDate(software.getUpdated(), "MMM, dd yyyy")  %>
						</div>
						<div class="info">
							<b>Sub Category:</b> <%=StringHelper.arrayList2String(software.getGenres(), ", ") %>
						</div>
						<div class="info">
							<b>Rating:</b> <%=software.getTrackContentRating() %>
						</div>
						<div class="info">
							<b>Language:</b> <%=StringHelper.arrayList2String(software.getLanguageCodesISO2A(), ", ") %>
						</div>
						<div class="info">
							<b>Game Center:</b> <%=software.getIsGameCenterEnabled() ? "Yes" : "No" %>
						</div>
						<% if (software.getSellerUrl() != null) { %>
						<div class="info">
							<b>Seller Url:</b> <a href="<%=software.getSellerUrl() %>"><%=software.getSellerUrl() %></a>
						</div>
						<% } %>
					</div>
    			</div>
    			<!-- 4 - end style1 -->
    		</div>
    		<!-- 3 - end right-pane -->
    		
    		<div class="clear"></div>
    	</div>
    	<!-- 2 - end main-content -->
    <% } %>
<jsp:include page="/layouts/footer.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>